@extends('home/base/person')
@section('information')
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>修改密码</title>

		<link href="{{ asset('AmazeUI-2.4.2/assets/css/admin.css') }}"  rel="stylesheet" type="text/css">
		<link href="{{ asset('AmazeUI-2.4.2/assets/css/amazeui.css') }}" rel="stylesheet" type="text/css">
		<link href="{{ asset('css/personal.css') }}" rel="stylesheet" type="text/css">
		<link href="{{ asset('css/stepstyle.css') }}" rel="stylesheet" type="text/css">

		<script type="text/javascript" src="{{ asset('js/jquery-1.7.2.min.js') }}"></script>
		<script src="{{ asset('AmazeUI-2.4.2/assets/js/amazeui.js') }}"></script>
	</head>
	<body>
		<div class="center">
			<div class="col-main">
				

					<div class="am-cf am-padding">
						<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">修改密码</strong> / <small>Password</small></div>
					</div>
					<hr/>
					<!--进度条-->
					<div class="m-progress">
						<div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">重置密码</p>
                            </span>
							<span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">完成</p>
                            </span>
							<span class="u-progress-placeholder"></span>
						</div>
						<div class="u-progress-bar total-steps-2">
							<div class="u-progress-bar-inner"></div>
						</div>
					</div>
					<form class="am-form am-form-horizontal" action="{{ url('home/person/userpwd') }}" method='post' id='tj'>
						{{ csrf_field() }}
						{{ method_field('POST') }}
						<div class="am-form-group">
							<label for="user-old-password" class="am-form-label">原密码</label>
							<div class="am-form-content">
								<input type="password" id="user-old-password" name='oldpassword' placeholder="请输入原登录密码"><span></span>
							</div>
						</div>
						<div class="am-form-group">
							<label for="user-new-password" class="am-form-label">新密码</label>
							<div class="am-form-content">
								<input type="password" id="user-new-password" name="userpwd" placeholder="由数字、字母组合"><span></span>
							</div>
						</div>
						<div class="am-form-group">
							<label for="user-confirm-password" class="am-form-label">确认密码</label>
							<div class="am-form-content">
								<input type="password" id="user-confirm-password" name="userpwd" placeholder="请再次输入上面的密码" ><span></span>
							</div>
						</div>
						<div class="info-btn">
							<div> <input type="submit" class="am-btn am-btn-danger" value="保存修改"></div>
						</div>
					</form>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		// var oldpass = $('#user-old-password').val();
		// alert(oldpass);
		var token = $('input[name="_token"]').val();
		var fld = false;
		var fld1 = false;
		$('#user-old-password').blur(function (){
			var oldpass = $('#user-old-password').val();
			$.ajax({
				url:'/home/person/password',
				type:'post',
				async:true,
				data:{'oldpassword':oldpass,'_token':token},
				// dataType: 'json',
				success:function (m){
					console.log(m);
					if(m == 1){

						$('#user-old-password').next('span').html('原密码正确').css('color','green');
						fld = true;
					}else{
						$('#user-old-password').next('span').html('原密码错误').css('color','red');
					}
				},
			});
		});
		$('#user-confirm-password').blur(function (){
			// 确认密码
			var newpass = $('#user-confirm-password').val();
			// 新密码
			var newpass1 = $('#user-new-password').val();
			if(newpass1 != ''){
			if(newpass == newpass1){
				$('#user-confirm-password').next('span').html('密码一致').css('color','green');
				fld1 = true;
			}else{
				$('#user-confirm-password').next('span').html('两次输入的不正确，请重新输入').css('color','red');
			}
			}		
		});
		
			$('#tj').submit(function (){
				if(fld1){
					return true;
				}else{
					return false;
				}
		});
		
	</script>
</html>

@endsection